package com.atguigu.bigdata.spark.core.rdd.builder;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.VoidFunction;
import scala.Int;
import scala.Tuple2;

import java.util.List;

public class Spark02_RDD_File1_JAVA {
    public static void main(String[] args) {
        // TODO 准备环境
        SparkConf conf = new SparkConf().setMaster("local[*]").setAppName("sparkCore");
        JavaSparkContext sc = new JavaSparkContext(conf);

        //(文件路径，文件内容)
        JavaPairRDD<String, String> rdd = sc.wholeTextFiles("datas");

        List<Tuple2<String, String>> list = rdd.collect();
        for(Tuple2<String, String> val : list) {
            System.out.println(val._2);
        }
    }
}
